<!--********************************************************************
* Copyright© 2000 - 2018 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title data-i18n="resources.title_osmlayer"></title>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
    var map, osmLayer, vector, dataAdded = false;
    map = new SuperMap.Map("map", {
        controls: [
            new SuperMap.Control.Navigation(),
            new SuperMap.Control.Zoom(),
            new SuperMap.Control.LayerSwitcher(),
            new SuperMap.Control.MousePosition()
        ]
    });
    osmLayer = new SuperMap.Layer.OSM("OSM");
    vector = new SuperMap.Layer.Vector("vector");
    map.addLayers([osmLayer, vector]);
    addData();
    var bounds = new SuperMap.Bounds(-33554432, -33554432, 33554432, 33554432);
    map.zoomToExtent(bounds);

    function addData() {
        if (!dataAdded) {
            vector.removeAllFeatures();
            //点对象
            var point = new SuperMap.Geometry.Point(0, 0);
            var pointVector = new SuperMap.Feature.Vector(point);
            pointVector.style = {
                fillColor: "red",
                strokeColor: "yellow",
                pointRadius: 10
            };
            vector.addFeatures([pointVector]);
            dataAdded = true;
        } else {
            widgets.alert.showAlert(resources.msg_loadedData, true);
        }
    }
</script>
</body>
</html>